{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = [[1, 2], [4, 5], [3, 6]]\n",
    "Y = [[1,2,3,4],[5,6,7,8]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "result = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# iterating by row of X\n",
    "for i in range(len(X)): \n",
    "  \n",
    "    # iterating by coloum by Y\n",
    "    for j in range(len(Y[0])): \n",
    "  \n",
    "        # iterating by rows of Y \n",
    "        for k in range(len(Y)): \n",
    "            result[i][j] += X[i][k] * Y[k][j]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[11, 14, 17, 20]\n",
      "[29, 38, 47, 56]\n",
      "[33, 42, 51, 60]\n"
     ]
    }
   ],
   "source": [
    "for r in result: \n",
    "    print(r)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
